<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>This tests that querySelector and querySelectorAll don't search outside their root node.</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
setup({ single_test: true });

var root = document.createElement('div');
var correctNode = document.createElement('div');
root.appendChild(correctNode);
document.body.appendChild(root);
var noChild = document.createElement('div');
document.body.appendChild(noChild);

assert_equals(root.querySelector('div'), correctNode);
assert_equals(root.querySelectorAll('div').length, 1);
assert_equals(root.querySelectorAll('div').item(0), correctNode);

assert_equals(noChild.querySelector('div'), null);
assert_equals(noChild.querySelectorAll('div').length, 0);
done();
</script>
</body>
</html>
